﻿using System;
using System.Collections.Generic;
using Core.Library;

namespace DataObject.Tag
{
    public class TagController
    {
        /***************************************
        = Back End
        -------------------------------------- */
        public static int Tag_Create(TagObject o)
        {
            return TagDAL.Tag_Create(o);
        }

        public static void Tag_Update(TagObject o)
        {
            TagDAL.Tag_Update(o);
        }

        public static void Tag_Delete(int id)
        {
            TagDAL.Tag_Delete(id);
        }

         public static int Tag_CheckNameExist(int id, string name)
         {
             return TagDAL.Tag_CheckNameExist(id, name);
         }

        public static List<TagObject> Tag_GetAll()
        {
            return ObjectHelper.MapRecords<TagObject>(TagDAL.Tag_GetAll());
        }

        public static TagObject Tag_GetById(int id)
        {
            return ObjectHelper.MapRecord<TagObject>(TagDAL.Tag_GetById(id));
        }

        public static List<TagObject> Tag_GetById_TypeId(long id, int typeId)
        {
            return ObjectHelper.MapRecords<TagObject>(TagDAL.Tag_GetById_TypeId(id, typeId));
        }

        public static int Tag_GetCount()
        {
            return TagDAL.Tag_GetCount();
        }

        public static List<TagObject> Tag_GetListPaging(int pageIndex, int pageSize)
        {
            return ObjectHelper.MapRecords<TagObject>(TagDAL.Tag_GetListPaging(pageIndex, pageSize));
        }
    }
}
